#include "stdafx.h"
#include "RF_protocol.h"
#include "../RF_dll.h"


extern HWND get_RF_DLLHWND();


extern void RF_DLL_SendData( unsigned char * p_strip,
							 unsigned char * p_data, 
							 unsigned char len, unsigned char sendTime );

esl_pro cmd_pro;
extern unsigned char s_sendData[64];
extern unsigned char s_sendLen;
extern unsigned char s_sendTime;
void rf_pro_deal( unsigned char *p_recv, unsigned short u_recv ){
	
	HWND hwnd = NULL;

	esl_pro t_pro;

	memset( &cmd_pro, 0 , sizeof( esl_pro));

	hwnd = get_RF_DLLHWND();

	if( hwnd != NULL && p_recv != NULL && u_recv >=CMD_CTRL_LEN ){

		memcpy( &t_pro,p_recv,sizeof(esl_pro) );

		if( t_pro.b_recall ){
			
			memcpy( &cmd_pro,p_recv,sizeof(esl_pro) );
			
			SendMessage( hwnd,WM_RECVESLDEVICE,(WPARAM)p_recv,NULL);

			if( t_pro.u_re_0 && s_sendTime < 3 ){

				RF_DLL_SendData(p_recv,s_sendData,s_sendLen ,s_sendTime+1);
			}

		}		
	}
}